﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Data.SqlClient;

namespace Agresso.Interface.Layer.Domain
{
    public class jGRNHeader
    {
        public int jGRNHeaderID;// int IDENTITY(1,1) NOT NULL,
        public string VslCode;// varchar(5) NULL,
        public string PoNo;// varchar(20) NULL,
        public long ArrivalID;// bigint NULL,
        public string DO_Number;// varchar(25) NULL,
        public DateTime ReceivedDate;// datetime NULL,
        public string ReceivedBy;// varchar(50) NULL,
        public string Place;//varchar(25) NULL,
        public string GRNComments;// varchar(255) NULL,
        public DateTime AddedOn;// datetime NULL,
        public int PickedUpFlag;// int NULL,
        public DateTime PickedUpAt;// datetime NULL,
        public string ResultDetails;// varchar(60) NULL,
        public string ExecutionID;// varchar(50) NULL,
        public string Remark;// varchar(50) NULL,

        public IList Details = new ArrayList();
        public jGRNHeader(SqlDataReader rd)
        {
            jGRNHeaderID = rd["jGRNHeaderID"] is DBNull ? jGRNHeaderID : Convert.ToInt32(rd["jGRNHeaderID"]);
            VslCode = rd["VslCode"] is DBNull ? VslCode : rd["VslCode"].ToString();
            PoNo = rd["PoNo"] is DBNull ? PoNo : rd["PoNo"].ToString();
            ArrivalID = rd["ArrivalID"] is DBNull ? ArrivalID : Convert.ToInt32(rd["ArrivalID"]);
            DO_Number = rd["DO_Number"] is DBNull ? DO_Number : rd["DO_Number"].ToString();
            ReceivedDate = rd["ReceivedDate"] is DBNull ? ReceivedDate : Convert.ToDateTime(rd["ReceivedDate"]);
            ReceivedBy = rd["ReceivedBy"] is DBNull ? ReceivedBy : rd["ReceivedBy"].ToString();
            Place = rd["Place"] is DBNull ? Place : rd["Place"].ToString();
            GRNComments = rd["GRNComments"] is DBNull ? GRNComments : rd["GRNComments"].ToString();
            AddedOn = rd["AddedOn"] is DBNull ? AddedOn : Convert.ToDateTime(rd["AddedOn"]);
            PickedUpFlag = rd["PickedUpFlag"] is DBNull ? PickedUpFlag : Convert.ToInt32(rd["PickedUpFlag"]);
            PickedUpAt = rd["PickedUpAt"] is DBNull ? PickedUpAt : Convert.ToDateTime(rd["PickedUpAt"]);
            ResultDetails = rd["ResultDetails"] is DBNull ? ResultDetails : rd["ResultDetails"].ToString();
            ExecutionID = rd["ExecutionID"] is DBNull ? ExecutionID : rd["ExecutionID"].ToString();
            Remark = rd["Remark"] is DBNull ? Remark : rd["Remark"].ToString();
        }
    }
}
